<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;

?>
<html>

<head>

<title>商家注册</title>

<link rel="stylesheet" type="text/css" href="Css/Login_style.css" />
</head>

<body>

<h2 align="center">注册</h2>

<div class="login_frame"></div>

<div class="LoginWindow">

  <div>

    <form method="post" action="javascript:void(0)"  class="login">

    <p>

      <label for="login">帐号:</label>

      <input type="text" name="id" id="account" value="">

    </p>



    <p>

      <label for="password">密码:</label>

      <input type="password" name="password" id="pwd" value="">

    </p>



    <p class="login-submit">
      <button class="login-button" id='login'>Login</button>

    </p>



    </form>

    <p class="registration"><a href="?w=businesslogin/index">马上登录</a></p>

  </div>

</div>

<script src='./jquery.js'></script>
<script>
  $(function(){
  	var login = '1';
  	$('#account').blur(function(){
  		var account=$(this).val();
  		$.ajax({
    			'type':'get',
    			'url':'?w=businesslogin/oneajax&account='+account,
    			success:function(o){
    				if(account==''){
    					alert('用户名不能为空');
    					return false;
    				}
    				if(o==2){
    					alert('用户名已存在')
    					login = '2';
    				}
    				if(o==1){
    					alert('用户名可用')
    					login = '1';
    				}
    			}
    		})
  	})
    	$('#login').click(function(){
    		var account = $('#account').val();
    		var pwd = $('#pwd').val();
    		// alert(login);return false;
    		if(account!=''&&pwd!=''&&login=='1'){
	    		$.ajax({
	    			'type':'get',
	    			'url':'?w=businesslogin/addajax',
	    			'data':{
	    				'account':account,
	    				'pwd':pwd
	    			},
	    			success:function(o){
	    				if(o==1){
	    					window.location.href = "index.php?w=business/index";
	    				}
	    			}
	    		})
    		}else{
    			return false;
    		}
    	})
  })
</script>

<div id="timeArea"><script> LoadBlogParts();</script></div>



</body>

</html>